package chp11;

import java.util.Scanner;

public class Game4 {

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        //游戏主管
        GameMaster gameMaster = new GameMaster();
        //电脑玩家
        Computer computer = new Computer();
        //人类玩家
        Person person = new Person();
        computer.init();
        person.init();

        while (true) {
            int myFist = person.showFist();
            int compFist = computer.showFist();
            int result = gameMaster.check(myFist, compFist);
            if(result == 1){
                person.score++;
            }else if(result == -1){
                computer.score++;
            }

            System.out.print("\n是否开始下一轮(y/n):");
            String answer = input.next();
            if(answer.equals("n")){
                break;
            }
        }

        System.out.println(person.name+" VS "+computer.name);
        System.out.println(person.score +"  : " + computer.score);
    }
}